/**
 * Copyright [2019] [LiBo/Alex of copyright liboware@gmail.com ]
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.hyts.slogger.format.text;

import com.hyts.slogger.base.SFormatter;
import com.hyts.slogger.config.DefaultConfig;
import sun.reflect.Reflection;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.util.Objects;
import java.util.Optional;

/**
 * @project-name:coffice-toolbox
 * @package-name:com.hyts.slogger.format.text
 * @author:LiBo/Alex
 * @create-date:2019-08-19 17:14
 * @copyright:libo-alex4java
 * @email:liboware@gmail.com
 * @description:
 */
public class ConsoleLoggerFormatter implements SFormatter<String> {


    @Override
    public String logHead(String formatPattern, String subject){
        if(Objects.isNull(formatPattern) && Objects.isNull(subject)){
            return String.format(DefaultConfig.DEFAULT_LOG_HEAD_TEXT_MESSAGE,LocalDateTime.now().
                    format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), Thread.currentThread().getStackTrace()[21].getClassName(), Thread.currentThread().getStackTrace()[21].getMethodName());
        }
        //TODO 待完成 解析器操作 - 进行解析功能的实现 - 解析logger format格式化处理器
        return "";
    }

    @Override
    public String logTail(String formatPattern, String subject) {
        if(Objects.isNull(formatPattern) && Objects.isNull(subject)){
            return DefaultConfig.DEFAULT_LOG_TAIL_TEXT_MESSAGE;
        }
        //TODO 待完成 解析器操作 - 进行解析功能的实现 - 解析logger format格式化处理器
        return "";
    }

    @Override
    public String logFormat(String formatStr, Object... args) {
        return String.format(formatStr,args);
    }

}
